/*
*******************************************************************************
* ansi c source code
* file name:
*	get_twiddle.c
* abstract:
*	to generate the twiddle  factor 
* author:Fangming He
*******************************************************************************
*/


/*
*******************************************************************************
*                               include files
*******************************************************************************
*/

#include <stdio.h>
#include <math.h>
#include "globaldef.h"

/*
*******************************************************************************
* 		                    global object definition
*******************************************************************************
*/


/*
*******************************************************************************
*                            function definition
*******************************************************************************
*/
/*
******************************************************************************* 
* description:
*    to generate the twiddle factor 
* input:
*   length : the size of FFT 
*   twiddle: the twiddle factors in 
* ouput
* author:
*	guo liang       2006-05-04
*******************************************************************************
*/

void get_twiddle (struct Complex *twiddle,int  length)
{
	double tmp;
	double delta;
	int i;
	delta = 8.0 * atan(1.0) / (length) ;
	for ( i = 0; i < length ; i++ )
	{
		tmp = i * delta;
		twiddle[i].real = cos ( tmp ) ;
		twiddle[i].imag = -sin ( tmp );
	}
	
}